package com.unohacha.qqj.fzdr.personal.view.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.unohacha.qqj.fzdr.R;
import com.unohacha.qqj.fzdr.personal.bean.UserInfoBean;
import com.unohacha.qqj.fzdr.personal.presenter.IPersonalPresenter;
import com.unohacha.qqj.fzdr.personal.presenter.PersonalPresenter;
import com.unohacha.qqj.fzdr.personal.view.IPersonal;
import com.unohacha.qqj.fzdr.util.Prefer;
import com.unohacha.qqj.mylibrary.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 确认手机号界面
 */
public class ConfirmPhoneActivity extends BaseActivity implements IPersonal {

    private IPersonalPresenter personalPresenter;

    @BindView(R.id.common_back)
    ImageView commonBack;
    @BindView(R.id.common_title)
    TextView commonTitle;
    @BindView(R.id.common_right_image)
    ImageView commonRightImage;
    @BindView(R.id.common_right_text)
    TextView commonRightText;

    @BindView(R.id.tv_phone)
    TextView tvPhone;

    @OnClick(R.id.btn_set_phone)
    void onSetPhoneClick() {
        jumpToOtherActivity(this, ChangePhoneActivity.class);
        finish();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_confirm_phone;
    }

    @OnClick(R.id.common_back)
    public void onViewClicked() {
        finish();
    }

    @Override
    protected void initView() {
//        super.initView();
        commonTitle.setText("手机号");
        commonRightImage.setVisibility(View.INVISIBLE);

        personalPresenter = new PersonalPresenter(this);
        // 获取用户信息
        personalPresenter.getUserInfo(Prefer.getInstance().getToken());
    }

    @Override
    public void showUserInfo(UserInfoBean userInfoBean) {
        tvPhone.setText(userInfoBean.getTelephone());
    }
}
